/*
//冒泡排序

public class Main{
    public static void mao_sort(int[] arr){
        int i = 0;
        int j = 0;
        int n = arr.length;
        for(i = 0; i < n-1; i++){
            for(j = 0;j < n-i-1; j++){
                if(arr[j] > arr[j+1]){
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
    }
    public static void main(String[] args){
        int[] arr = new int[]{12,14,3,67,45,86,8,13};

        mao_sort(arr);

        for(int i = 0; i < arr.length; i++){
            System.out.print(arr[i]+ " ");
        }
    }
}

 */
//直接选择排序

public class Main{
    public static void main(String[] args){
        int[] arr = new int[]{63,4,24,1,3,15};
        direct_chose_sort(arr);
        for(int i = 0;i < arr.length;i++){
            System.out.print(arr[i]+" ");
        }
    }

    public static void direct_chose_sort(int[] arr){
        int count;
        int i = 0;
        int j = 0;
        for(i = 1; i < arr.length; i++){
            count = 0;
            for(j = 1; j <= arr.length-i; j++){
                if(arr[j] > arr[count]){
                    count = j;
                }
            }
            int temp = arr[arr.length - i ];
            arr[arr.length - i ] = arr[count];
            arr[count] = temp;
        }
    }
}